import { createRouter, createWebHashHistory } from 'vue-router'
import { asyncComponent } from '@/utils'

const router = createRouter({
	history: createWebHashHistory(),
	routes: [
		{
			path: '/',
      redirect: '/view-config'
		},
		{
			path: '/base/page-making/:code',
			name: 'pm',
			component: asyncComponent('PageMaking')
		},
		{
			path: '/view-config',
			name: 'viewConfig',
			component: asyncComponent('viewConfig')
		},
		{
			path: '/:pathMatch(.*)',
			name: 'NotFound',
			component: asyncComponent('NotFound')
		}
	]
})

router.beforeEach((to, from, next) => {
	next()
})

export default router